@model IEnumerable<LanLordz.Models.ThreadInformation>
@{
    var controller = this.ViewContext.Controller as LanLordzBaseController;
}
    <table>
     <tr>
      <th>&nbsp;</th>
      <th>Thread</th>
      <th>Posts</th>
      <th>Views</th>
      <th>Author</th>
      <th>Last Post</th>
     </tr>
     @if (Model != null && Model.Any()) {
     foreach (var thread in Model)
     {
     <tr class="Thread @(thread.Thread.IsLocked ? "ThreadLocked" : "") @("Thread" + thread.Level + (thread.Read ? "Read" : "Unread"))">
      <td><div class="ThreadIndicator"></div></td>
      <td class="ThreadDescription"><a href="@(Url.Action("ViewThread", new { id = thread.Thread.ThreadID, title = controller.CreateUrlTitle(thread.Thread.Title), page = LanLordz.SiteTools.Pager.PageCount(thread.Posts > thread.ReadCount ? thread.ReadCount + 1 : thread.ReadCount, 25) }) + (thread.FirstUnreadID.HasValue ? "#" + thread.FirstUnreadID.Value.ToString() : ""))">@(string.IsNullOrEmpty(thread.Thread.Title) ? "(No Title)" : thread.Thread.Title)</a></td>
      <td class="ThreadPostCount">@thread.Posts</td>
      <td class="ThreadViewCount">@thread.Thread.Views</td>
      <td class="ThreadOwner">
       @if (thread.Posts == 0)
       {
       <text>No Posts</text>
       }
       else {
       @Html.ActionLink(thread.FirstPostUsername, "ViewProfile", "Account", new { id = thread.FirstPostUserID.Value, title = controller.CreateUrlTitle(thread.FirstPostUsername) }, null)
       }
      </td>
      <td class="ThreadLastPost">
       @if (thread.Posts == 0)
       {
       <text>No Posts</text>
       }
       else
       {
       <div class="ThreadLastPostDate">@controller.ConvertDateTime(thread.LastPostDate)</div>
       <div class="ThreadLastPostUser">@Html.ActionLink(thread.LastPostUsername, "ViewProfile", "Account", new { id = thread.LastPostUserID.Value, title = controller.CreateUrlTitle(thread.LastPostUsername) }, null)</div>
       }
      </td>
     </tr>
     }
     }
     else
     {
     <tr>
      <td class="ThreadsTableEmpty" colspan="6">There are no threads to show in this view.</td>
     </tr>
     }
    </table>
